﻿namespace ACCOUNTING
{
    using ACCOUNTING.LVY.Business;
    using ACCOUNTING.My;
    using ACCOUNTING.My.Resources;
    using C1.Win.C1Command;
    using C1.Win.C1FlexGrid;
    using C1.Win.C1FlexGrid.Util.BaseControls;
    using C1.Win.C1Input;
    using Microsoft.VisualBasic;
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Diagnostics;
    using System.Drawing;
    using System.Runtime.CompilerServices;
    using System.Windows.Forms;

    [DesignerGenerated]
    public class Frm_00TestParentChild : Form
    {
        #region Class field
        private static List<WeakReference> __ENCList = new List<WeakReference>();
        [AccessedThroughProperty("C1DockingTab1")]
        private C1DockingTab _C1DockingTab1;
        [AccessedThroughProperty("C1DockingTab2")]
        private C1DockingTab _C1DockingTab2;
        [AccessedThroughProperty("C1DockingTabPage1")]
        private C1DockingTabPage _C1DockingTabPage1;
        [AccessedThroughProperty("C1DockingTabPage2")]
        private C1DockingTabPage _C1DockingTabPage2;
        [AccessedThroughProperty("CboLoaiDT")]
        private ComboBox _CboLoaiDT;
        [AccessedThroughProperty("_CboThuoc")]
        private ComboBox _CboThuoc;
        [AccessedThroughProperty("CmdAdd")]
        private ToolStripButton _CmdAdd;
        [AccessedThroughProperty("CmdAddRow")]
        private Button _CmdAddRow;
        [AccessedThroughProperty("CmdCopy")]
        private Button _CmdCopy;
        [AccessedThroughProperty("CmdDel")]
        private ToolStripButton _CmdDel;
        [AccessedThroughProperty("CmdDelRow")]
        private Button _CmdDelRow;
        [AccessedThroughProperty("CmdEdit")]
        private ToolStripButton _CmdEdit;
        [AccessedThroughProperty("cmdHelp")]
        private ToolStripButton _cmdHelp;
        [AccessedThroughProperty("CmdPrint")]
        private ToolStripButton _CmdPrint;
        [AccessedThroughProperty("CmdSave")]
        private ToolStripButton _CmdSave;
        [AccessedThroughProperty("CmdTimDonHang")]
        private Button _CmdTimDonHang;
        [AccessedThroughProperty("CmdUnsave")]
        private ToolStripButton _CmdUnsave;
        [AccessedThroughProperty("Label1")]
        private Label _Label1;
        [AccessedThroughProperty("Label2")]
        private Label _Label2;
        [AccessedThroughProperty("Label3")]
        private Label _Label3;
        [AccessedThroughProperty("Label4")]
        private Label _Label4;
        [AccessedThroughProperty("Label5")]
        private Label _Label5;
        [AccessedThroughProperty("Label6")]
        private Label _Label6;
        [AccessedThroughProperty("Label7")]
        private Label _Label7;
        [AccessedThroughProperty("Panel4")]
        private Panel _Panel4;
        [AccessedThroughProperty("Panel5")]
        private Panel _Panel5;
        [AccessedThroughProperty("ToolStrip1")]
        private ToolStrip _ToolStrip1;
        [AccessedThroughProperty("ToolStripButton1")]
        private ToolStripSeparator _ToolStripButton1;
        [AccessedThroughProperty("ToolStripSeparator1")]
        private ToolStripSeparator _ToolStripSeparator1;
        [AccessedThroughProperty("ToolStripSeparator2")]
        private ToolStripSeparator _ToolStripSeparator2;
        [AccessedThroughProperty("TxtDienGiai")]
        private TextBox _TxtDienGiai;
        [AccessedThroughProperty("TxtMa")]
        private TextBox _TxtMa;
        [AccessedThroughProperty("TxtTenViet")]
        private TextBox _TxtTenViet;
        [AccessedThroughProperty("TxtTenAnh")]
        private TextBox _TxtTenAnh;
        [AccessedThroughProperty("VSList")]
        private C1.Win.C1FlexGrid.C1FlexGrid _VSList;
        private string cFrmFormat;
        public string cFrmKhoa;
        private string cFrmKhoaOld;
        public int cFrmPhanBoChietKhau;
        public string cFrmTask;
        private IContainer components;
        private bool mAllowAdd;
        private bool mAllowDel;
        private bool mAllowEdit;
        private bool mAllowView;
        private bool mEnabledControl;
        private clsDMDoiTuongTapHopChiPhi objNK;
        private clsDoiTuongTHCPChiTiet objNKDV;
        private CheckBox checkBox1;
        private ToolStripButton _CmdExit;
        ComponentResourceManager manager;
        #endregion
        public Frm_00TestParentChild()
        {
            base.KeyDown += new KeyEventHandler(this.Frm_NhapKho_KeyDown);
            base.Load += new EventHandler(this.Frm_NhapKho_Load);
            List<WeakReference> list = __ENCList;
            lock (list)
            {
                __ENCList.Add(new WeakReference(this));
            }
            this.mAllowEdit = true;
            this.mAllowDel = true;
            this.cFrmKhoa = "";
            this.cFrmKhoaOld = "";
            this.objNK = new clsDMDoiTuongTapHopChiPhi();
            this.objNKDV = new clsDoiTuongTHCPChiTiet();
            this.cFrmTask = "";
            this.InitializeComponent();
        }

        public bool CheckGrid()
        {
            //if (this.VSList.Rows.Count == 1)
            //{
            //    LVYModule.ShowWarning(modGeneral.Tranlated("Bạn chưa nhập h\x00e0ng h\x00f3a !", ""));
            //    this.CmdAddRow.Focus();
            //    return false;
            //}
            //int num2 = this.VSList.Rows.Count - 1;
            //for (int i = 1; i <= num2; i++)
            //{
            //    if (LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSList[i, 1]), "", modGeneral.TypeOfValue.Nothing).ToString().Trim() == "")
            //    {
            //        LVYModule.ShowWarning(modGeneral.Tranlated("Bạn phải nhập số t\x00e0i khoản!", ""));
            //        this.VSList.Focus();
            //        this.VSList.Select(i, 2);
            //        return false;
            //    }
            //    if (LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSList[i, 3]), "", modGeneral.TypeOfValue.Nothing).ToString().Trim() == "")
            //    {
            //        LVYModule.ShowWarning(modGeneral.Tranlated("Bạn phải nhập t\x00ean dịch vụ mua v\x00e0o!", ""));
            //        this.VSList.Focus();
            //        this.VSList.Select(i, 3);
            //        return false;
            //    }
            //}
            return true;
        }

        public bool CheckIvalid()
        {

            if (!this.CheckGrid())
            {
                return false;
            }
            return true;

        }

        private void CmdAdd_Click(object sender, EventArgs e)
        {
            if (this.cFrmKhoa.Trim() != "")
            {
                this.cFrmKhoaOld = this.cFrmKhoa;
            }
            this.EmptyData();
            this.cFrmKhoa = modGeneral.CreatKey("DM_DoiTuongTapHopChiPhi", 15, "DC");
            this.EnabledControl = true;
            this.cFrmTask = "I";
        }

        private void CmdAddRow_Click(object sender, EventArgs e)
        {

            this.VSList.AddItem("");
            // this.VSList.Select(this.VSList.Rows.Count - 1, 2);
            this.VSList.Focus();

        }

        private void CmdCopy_Click(object sender, EventArgs e)
        {
            if ((this.VSList.Rows.Count != 1) && (this.VSList.Row > 0))
            {
                this.VSList.AddItem("");
                int num2 = this.VSList.Cols.Count - 1;
                for (int i = 0; i <= num2; i++)
                {
                    this.VSList[this.VSList.Rows.Count - 1, i] = RuntimeHelpers.GetObjectValue(this.VSList[this.VSList.Row, i]);
                    this.VSList[this.VSList.Rows.Count - 1, 0] = "";
                    this.VSList[this.VSList.Rows.Count - 1, 7] = "";
                }
            }
        }

        private void CmdDel_Click(object sender, EventArgs e)
        {
            
            if (((LVYModule.ReturnIfNull(this.cFrmKhoa, "", modGeneral.TypeOfValue.Nothing).ToString().Trim() != "") && LVYModule.ConfirmDelete("")) && this.objNK.DeleteData(this.cFrmKhoa))
            {
                this.EmptyData();
            }
        }

        private void CmdDelRow_Click(object sender, EventArgs e)
        {
            if (this.VSList.Rows.Count != 1)
            {
                this.VSList.RemoveItem(this.VSList.Row);
            }
        }

        private void CmdEdit_Click(object sender, EventArgs e)
        {

        }

        private void CmdExit_Click(object sender, EventArgs e)
        {
            this.Dispose();
        }

        private void CmdPrint_Click(object sender, EventArgs e)
        {
            ReportModule.PrintHoaDonMuaDichVu(this.cFrmKhoa);
        }

        private void CmdUnsave_Click(object sender, EventArgs e)
        {
            if (LVYModule.ReturnIfNull(this.cFrmKhoaOld, "", modGeneral.TypeOfValue.Nothing).ToString().Trim() != "")
            {
                this.cFrmKhoa = this.cFrmKhoaOld;
                this.ShowData(this.cFrmKhoa);
            }
            else
            {
                this.EmptyData();
            }

            this.cFrmTask = "";
            this.EnabledControl = false;
        }

        [DebuggerNonUserCode]
        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        public void EmptyData()
        {
            this.cFrmTask = "I";
            this.objNK.SetBlank();
            this.TxtDienGiai.Text = "";
            this.TxtTenViet.Text = "";
            this.TxtTenAnh.Text = "";
            this.CboLoaiDT.SelectedValue = "";
            this.CboThuoc.SelectedValue = "";
            this.VSList.Select(0, 1);
            this.VSList.Rows.Count = 1;
        }

        public void FormatNumber()
        {
            this.VSList.Cols[8].Format = this.cFrmFormat;
            this.VSList.Cols[10].Format = this.cFrmFormat;
            this.VSList.Cols[8].Format = modGeneral.H_FORMATNUMBER;
            this.VSList.Cols[12].Format = modGeneral.H_FORMATNUMBER;
        }

        private void Frm_NhapKho_KeyDown(object sender, KeyEventArgs e)
        {
            Keys keyCode = e.KeyCode;
            if (keyCode == Keys.Escape)
            {
                if (this.CmdExit.Enabled)
                {
                    this.CmdExit_Click(RuntimeHelpers.GetObjectValue(sender), e);
                }
            }
            else if (keyCode == Keys.F2)
            {
                if (this.CmdEdit.Enabled)
                {
                    this.CmdEdit_Click(RuntimeHelpers.GetObjectValue(sender), e);
                }
            }           
            else if (keyCode == Keys.F8)
            {
                if (this.CmdAdd.Enabled)
                {
                    this.CmdAdd_Click(RuntimeHelpers.GetObjectValue(sender), e);
                }
            }
            else if (keyCode == Keys.F9)
            {
                if (this.CmdDel.Enabled)
                {
                    this.CmdDel_Click(RuntimeHelpers.GetObjectValue(sender), e);
                }
            }
            else if (keyCode == Keys.F10)
            {
                if (this.CmdSave.Enabled)
                {
                    this.CmdSave_Click(RuntimeHelpers.GetObjectValue(sender), e);
                }
            }
            else if (keyCode == Keys.F11)
            {
                if (this.CmdUnsave.Enabled)
                {
                    this.CmdUnsave_Click(RuntimeHelpers.GetObjectValue(sender), e);
                }
            }
            else if ((keyCode == Keys.F12) && this.CmdPrint.Enabled)
            {
                this.CmdPrint_Click(RuntimeHelpers.GetObjectValue(sender), e);
            }
        }

        private void Frm_NhapKho_Load(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;
            LVYModule.GetUserRight(ref this.mAllowView, ref this.mAllowDel, ref this.mAllowEdit, ref this.mAllowAdd, Conversions.ToString(this.Tag), modGeneral.H_USERNAME);
            if (!this.mAllowView)
            {
                this.Cursor = Cursors.Default;
                LVYModule.ShowWarning(modGeneral.Tranlated("Bạn kh\x00f4ng c\x00f3 quyền xem, li\x00ean hệ với người quản trị để biết th\x00eam chi tiết.", ""));
                this.Dispose();
            }
            else
            {
                SetEvents();
                this.EnabledControl = false;
                this.KeyPreview = true;
                this.cFrmFormat = modGeneral.H_FORMATNUMBER;
                BuildComboModule.BuildCombo(this.CboLoaiDT, modGeneral.ListDanhMuc.LoaiDTTHCP, false, "", "");
                BuildComboModule.BuildCombo(this.CboThuoc, modGeneral.ListDanhMuc.DTTHCP, false, "", "");
                if (LVYModule.ReturnIfNull(this.cFrmKhoa, "", modGeneral.TypeOfValue.Nothing).ToString().Trim() != "")
                {
                    this.ShowData(this.cFrmKhoa);
                }
                if (this.cFrmTask == "I")
                {
                    this.CmdAdd_Click(this, e);
                }
                if (this.cFrmTask == "U")
                {
                    this.CmdEdit_Click(this, e);
                }
                this.Cursor = Cursors.Default;
            }
        }

        private void SetEvents()
        {
            this._CmdAdd.Click += this.CmdAdd_Click;
            this._CmdCopy.Click += this.CmdCopy_Click;
            this._CmdDelRow.Click += this.CmdDelRow_Click;
            this._CmdEdit.Click += this.CmdEdit_Click;
            this._CmdExit.Click += this.CmdExit_Click;
            this._CmdPrint.Click += this.CmdPrint_Click;
            this._CmdSave.Click += this.CmdSave_Click;
            this._CmdUnsave.Click += this.CmdUnsave_Click;
            this._VSList.AfterEdit += this.VSList_AfterEdit;
            this._VSList.BeforeEdit += this.VSList_BeforeEdit;
            this._CmdAddRow.Click += this.CmdAddRow_Click;
            this._CmdDel.Click += this.CmdDel_Click ;           ;

        }

        //  [DebuggerStepThrough]
        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Frm_00TestParentChild));
            this._ToolStrip1 = new System.Windows.Forms.ToolStrip();
            this._CmdAdd = new System.Windows.Forms.ToolStripButton();
            this._CmdEdit = new System.Windows.Forms.ToolStripButton();
            this._ToolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
            this._CmdSave = new System.Windows.Forms.ToolStripButton();
            this._CmdUnsave = new System.Windows.Forms.ToolStripButton();
            this._ToolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
            this._CmdPrint = new System.Windows.Forms.ToolStripButton();
            this._ToolStripButton1 = new System.Windows.Forms.ToolStripSeparator();
            this._CmdDel = new System.Windows.Forms.ToolStripButton();
            this._cmdHelp = new System.Windows.Forms.ToolStripButton();
            this._C1DockingTab1 = new C1.Win.C1Command.C1DockingTab();
            this._C1DockingTabPage1 = new C1.Win.C1Command.C1DockingTabPage();
            this._Label6 = new System.Windows.Forms.Label();
            this._Label4 = new System.Windows.Forms.Label();
            this._Label5 = new System.Windows.Forms.Label();
            this._TxtTenAnh = new System.Windows.Forms.TextBox();
            this.checkBox1 = new System.Windows.Forms.CheckBox();
            this._CboLoaiDT = new System.Windows.Forms.ComboBox();
            this._TxtTenViet = new System.Windows.Forms.TextBox();
            this._Label3 = new System.Windows.Forms.Label();
            this._TxtMa = new System.Windows.Forms.TextBox();
            this._CmdTimDonHang = new System.Windows.Forms.Button();
            this._TxtDienGiai = new System.Windows.Forms.TextBox();
            this._CboThuoc = new System.Windows.Forms.ComboBox();
            this._Label2 = new System.Windows.Forms.Label();
            this._Label1 = new System.Windows.Forms.Label();
            this._Panel4 = new System.Windows.Forms.Panel();
            this._CmdCopy = new System.Windows.Forms.Button();
            this._CmdDelRow = new System.Windows.Forms.Button();
            this._CmdAddRow = new System.Windows.Forms.Button();
            this._Panel5 = new System.Windows.Forms.Panel();
            this._C1DockingTab2 = new C1.Win.C1Command.C1DockingTab();
            this._C1DockingTabPage2 = new C1.Win.C1Command.C1DockingTabPage();
            this._VSList = new C1.Win.C1FlexGrid.C1FlexGrid();
            this._CmdExit = new System.Windows.Forms.ToolStripButton();
            this._ToolStrip1.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this._C1DockingTab1)).BeginInit();
            this._C1DockingTab1.SuspendLayout();
            this._C1DockingTabPage1.SuspendLayout();
            this._Panel4.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this._C1DockingTab2)).BeginInit();
            this._C1DockingTab2.SuspendLayout();
            this._C1DockingTabPage2.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this._VSList)).BeginInit();
            this.SuspendLayout();
            // 
            // _ToolStrip1
            // 
            this._ToolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this._CmdAdd,
            this._CmdEdit,
            this._ToolStripSeparator2,
            this._CmdSave,
            this._CmdUnsave,
            this._ToolStripSeparator1,
            this._CmdPrint,
            this._ToolStripButton1,
            this._CmdDel,
            this._CmdExit,
            this._cmdHelp});
            this._ToolStrip1.Location = new System.Drawing.Point(0, 0);
            this._ToolStrip1.Name = "_ToolStrip1";
            this._ToolStrip1.Size = new System.Drawing.Size(895, 25);
            this._ToolStrip1.TabIndex = 0;
            this._ToolStrip1.Text = "ToolStrip1";
            // 
            // _CmdAdd
            // 
            this._CmdAdd.Image = ((System.Drawing.Image)(resources.GetObject("_CmdAdd.Image")));
            this._CmdAdd.ImageTransparentColor = System.Drawing.Color.White;
            this._CmdAdd.Name = "_CmdAdd";
            this._CmdAdd.Size = new System.Drawing.Size(82, 22);
            this._CmdAdd.Text = "&Thêm mới";
            this._CmdAdd.ToolTipText = "F8 Thêm mới";
            // 
            // _CmdEdit
            // 
            this._CmdEdit.Image = ((System.Drawing.Image)(resources.GetObject("_CmdEdit.Image")));
            this._CmdEdit.ImageTransparentColor = System.Drawing.Color.White;
            this._CmdEdit.Name = "_CmdEdit";
            this._CmdEdit.Size = new System.Drawing.Size(46, 22);
            this._CmdEdit.Text = "&Sửa";
            this._CmdEdit.ToolTipText = "F2 Sửa";
            // 
            // _ToolStripSeparator2
            // 
            this._ToolStripSeparator2.Name = "_ToolStripSeparator2";
            this._ToolStripSeparator2.Size = new System.Drawing.Size(6, 25);
            // 
            // _CmdSave
            // 
            this._CmdSave.Image = ((System.Drawing.Image)(resources.GetObject("_CmdSave.Image")));
            this._CmdSave.ImageTransparentColor = System.Drawing.Color.WhiteSmoke;
            this._CmdSave.Name = "_CmdSave";
            this._CmdSave.Size = new System.Drawing.Size(47, 22);
            this._CmdSave.Text = "&Lưu";
            this._CmdSave.ToolTipText = "F10 Lưu";
            // 
            // _CmdUnsave
            // 
            this._CmdUnsave.Image = ((System.Drawing.Image)(resources.GetObject("_CmdUnsave.Image")));
            this._CmdUnsave.ImageTransparentColor = System.Drawing.Color.White;
            this._CmdUnsave.Name = "_CmdUnsave";
            this._CmdUnsave.Size = new System.Drawing.Size(57, 22);
            this._CmdUnsave.Text = "&K.Lưu";
            this._CmdUnsave.ToolTipText = "F11 Không lưu";
            // 
            // _ToolStripSeparator1
            // 
            this._ToolStripSeparator1.Name = "_ToolStripSeparator1";
            this._ToolStripSeparator1.Size = new System.Drawing.Size(6, 25);
            // 
            // _CmdPrint
            // 
            this._CmdPrint.Image = ((System.Drawing.Image)(resources.GetObject("_CmdPrint.Image")));
            this._CmdPrint.ImageTransparentColor = System.Drawing.Color.White;
            this._CmdPrint.Name = "_CmdPrint";
            this._CmdPrint.Size = new System.Drawing.Size(37, 22);
            this._CmdPrint.Text = "&In";
            this._CmdPrint.ToolTipText = "F12 In";
            // 
            // _ToolStripButton1
            // 
            this._ToolStripButton1.Name = "_ToolStripButton1";
            this._ToolStripButton1.Size = new System.Drawing.Size(6, 25);
            // 
            // _CmdDel
            // 
            this._CmdDel.Image = ((System.Drawing.Image)(resources.GetObject("_CmdDel.Image")));
            this._CmdDel.ImageTransparentColor = System.Drawing.Color.White;
            this._CmdDel.Name = "_CmdDel";
            this._CmdDel.Size = new System.Drawing.Size(47, 22);
            this._CmdDel.Text = "&Xóa";
            this._CmdDel.ToolTipText = "F9 Xóa";
            // 
            // _cmdHelp
            // 
            this._cmdHelp.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
            this._cmdHelp.Image = ((System.Drawing.Image)(resources.GetObject("_cmdHelp.Image")));
            this._cmdHelp.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
            this._cmdHelp.ImageTransparentColor = System.Drawing.Color.White;
            this._cmdHelp.Name = "_cmdHelp";
            this._cmdHelp.Size = new System.Drawing.Size(53, 22);
            this._cmdHelp.Text = "&Help";
            // 
            // _C1DockingTab1
            // 
            this._C1DockingTab1.Controls.Add(this._C1DockingTabPage1);
            this._C1DockingTab1.Dock = System.Windows.Forms.DockStyle.Top;
            this._C1DockingTab1.Location = new System.Drawing.Point(0, 25);
            this._C1DockingTab1.Name = "_C1DockingTab1";
            this._C1DockingTab1.Size = new System.Drawing.Size(895, 183);
            this._C1DockingTab1.TabIndex = 0;
            this._C1DockingTab1.TabsSpacing = 5;
            this._C1DockingTab1.TabStyle = C1.Win.C1Command.TabStyleEnum.Office2007;
            this._C1DockingTab1.VisualStyle = C1.Win.C1Command.VisualStyle.Office2007Blue;
            this._C1DockingTab1.VisualStyleBase = C1.Win.C1Command.VisualStyle.Office2007Blue;
            // 
            // _C1DockingTabPage1
            // 
            this._C1DockingTabPage1.Controls.Add(this._Label6);
            this._C1DockingTabPage1.Controls.Add(this._Label4);
            this._C1DockingTabPage1.Controls.Add(this._Label5);
            this._C1DockingTabPage1.Controls.Add(this._TxtTenAnh);
            this._C1DockingTabPage1.Controls.Add(this.checkBox1);
            this._C1DockingTabPage1.Controls.Add(this._CboLoaiDT);
            this._C1DockingTabPage1.Controls.Add(this._TxtTenViet);
            this._C1DockingTabPage1.Controls.Add(this._Label3);
            this._C1DockingTabPage1.Controls.Add(this._TxtMa);
            this._C1DockingTabPage1.Controls.Add(this._CmdTimDonHang);
            this._C1DockingTabPage1.Controls.Add(this._TxtDienGiai);
            this._C1DockingTabPage1.Controls.Add(this._CboThuoc);
            this._C1DockingTabPage1.Controls.Add(this._Label2);
            this._C1DockingTabPage1.Controls.Add(this._Label1);
            this._C1DockingTabPage1.Location = new System.Drawing.Point(1, 24);
            this._C1DockingTabPage1.Name = "_C1DockingTabPage1";
            this._C1DockingTabPage1.Size = new System.Drawing.Size(893, 158);
            this._C1DockingTabPage1.TabIndex = 0;
            this._C1DockingTabPage1.Text = "Thông tin ĐTTHCP";
            // 
            // _Label6
            // 
            this._Label6.AutoSize = true;
            this._Label6.BackColor = System.Drawing.Color.Transparent;
            this._Label6.Location = new System.Drawing.Point(22, 99);
            this._Label6.Name = "_Label6";
            this._Label6.Size = new System.Drawing.Size(50, 13);
            this._Label6.TabIndex = 174;
            this._Label6.Text = "Diễn Giải";
            // 
            // _Label4
            // 
            this._Label4.AutoSize = true;
            this._Label4.BackColor = System.Drawing.Color.Transparent;
            this._Label4.Location = new System.Drawing.Point(532, 16);
            this._Label4.Name = "_Label4";
            this._Label4.Size = new System.Drawing.Size(47, 13);
            this._Label4.TabIndex = 173;
            this._Label4.Text = "Tên Việt";
            // 
            // _Label5
            // 
            this._Label5.AutoSize = true;
            this._Label5.BackColor = System.Drawing.Color.Transparent;
            this._Label5.Location = new System.Drawing.Point(532, 42);
            this._Label5.Name = "_Label5";
            this._Label5.Size = new System.Drawing.Size(48, 13);
            this._Label5.TabIndex = 172;
            this._Label5.Text = "Tên Anh";
            // 
            // _TxtTenAnh
            // 
            this._TxtTenAnh.Location = new System.Drawing.Point(605, 39);
            this._TxtTenAnh.Name = "_TxtTenAnh";
            this._TxtTenAnh.Size = new System.Drawing.Size(247, 20);
            this._TxtTenAnh.TabIndex = 171;
            // 
            // checkBox1
            // 
            this.checkBox1.AutoSize = true;
            this.checkBox1.Checked = true;
            this.checkBox1.CheckState = System.Windows.Forms.CheckState.Checked;
            this.checkBox1.Location = new System.Drawing.Point(535, 66);
            this.checkBox1.Name = "checkBox1";
            this.checkBox1.Size = new System.Drawing.Size(56, 17);
            this.checkBox1.TabIndex = 170;
            this.checkBox1.Text = "Active";
            this.checkBox1.UseVisualStyleBackColor = true;
            // 
            // _CboLoaiDT
            // 
            this._CboLoaiDT.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this._CboLoaiDT.FormattingEnabled = true;
            this._CboLoaiDT.Location = new System.Drawing.Point(114, 13);
            this._CboLoaiDT.Name = "_CboLoaiDT";
            this._CboLoaiDT.Size = new System.Drawing.Size(290, 21);
            this._CboLoaiDT.TabIndex = 169;
            this._CboLoaiDT.SelectedIndexChanged += new System.EventHandler(this._CboLoaiDT_SelectedIndexChanged);
            // 
            // _TxtTenViet
            // 
            this._TxtTenViet.Location = new System.Drawing.Point(605, 13);
            this._TxtTenViet.Name = "_TxtTenViet";
            this._TxtTenViet.Size = new System.Drawing.Size(247, 20);
            this._TxtTenViet.TabIndex = 11;
            // 
            // _Label3
            // 
            this._Label3.AutoSize = true;
            this._Label3.BackColor = System.Drawing.Color.Transparent;
            this._Label3.Location = new System.Drawing.Point(22, 69);
            this._Label3.Name = "_Label3";
            this._Label3.Size = new System.Drawing.Size(22, 13);
            this._Label3.TabIndex = 157;
            this._Label3.Text = "Mã";
            // 
            // _TxtMa
            // 
            this._TxtMa.Location = new System.Drawing.Point(114, 66);
            this._TxtMa.Name = "_TxtMa";
            this._TxtMa.Size = new System.Drawing.Size(161, 20);
            this._TxtMa.TabIndex = 10;
            // 
            // _CmdTimDonHang
            // 
            this._CmdTimDonHang.Location = new System.Drawing.Point(1093, 12);
            this._CmdTimDonHang.Name = "_CmdTimDonHang";
            this._CmdTimDonHang.Size = new System.Drawing.Size(24, 22);
            this._CmdTimDonHang.TabIndex = 155;
            this._CmdTimDonHang.Text = "...";
            this._CmdTimDonHang.UseVisualStyleBackColor = true;
            // 
            // _TxtDienGiai
            // 
            this._TxtDienGiai.Location = new System.Drawing.Point(114, 92);
            this._TxtDienGiai.Name = "_TxtDienGiai";
            this._TxtDienGiai.Size = new System.Drawing.Size(768, 20);
            this._TxtDienGiai.TabIndex = 17;
            // 
            // _CboThuoc
            // 
            this._CboThuoc.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this._CboThuoc.FormattingEnabled = true;
            this._CboThuoc.Location = new System.Drawing.Point(114, 36);
            this._CboThuoc.Name = "_CboThuoc";
            this._CboThuoc.Size = new System.Drawing.Size(161, 21);
            this._CboThuoc.TabIndex = 2;
            // 
            // _Label2
            // 
            this._Label2.AutoSize = true;
            this._Label2.BackColor = System.Drawing.Color.Transparent;
            this._Label2.Location = new System.Drawing.Point(22, 39);
            this._Label2.Name = "_Label2";
            this._Label2.Size = new System.Drawing.Size(38, 13);
            this._Label2.TabIndex = 148;
            this._Label2.Text = "Thuộc";
            this._Label2.TextAlign = System.Drawing.ContentAlignment.TopRight;
            // 
            // _Label1
            // 
            this._Label1.AutoSize = true;
            this._Label1.BackColor = System.Drawing.Color.Transparent;
            this._Label1.Location = new System.Drawing.Point(22, 16);
            this._Label1.Name = "_Label1";
            this._Label1.Size = new System.Drawing.Size(45, 13);
            this._Label1.TabIndex = 144;
            this._Label1.Text = "Loại ĐT";
            // 
            // _Panel4
            // 
            this._Panel4.Controls.Add(this._CmdCopy);
            this._Panel4.Controls.Add(this._CmdDelRow);
            this._Panel4.Controls.Add(this._CmdAddRow);
            this._Panel4.Controls.Add(this._Panel5);
            this._Panel4.Dock = System.Windows.Forms.DockStyle.Bottom;
            this._Panel4.Location = new System.Drawing.Point(0, 481);
            this._Panel4.Name = "_Panel4";
            this._Panel4.Size = new System.Drawing.Size(895, 88);
            this._Panel4.TabIndex = 1;
            // 
            // _CmdCopy
            // 
            this._CmdCopy.Image = ((System.Drawing.Image)(resources.GetObject("_CmdCopy.Image")));
            this._CmdCopy.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this._CmdCopy.Location = new System.Drawing.Point(185, 3);
            this._CmdCopy.Name = "_CmdCopy";
            this._CmdCopy.Size = new System.Drawing.Size(91, 24);
            this._CmdCopy.TabIndex = 2;
            this._CmdCopy.Text = "&3.Copy dòng";
            this._CmdCopy.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
            this._CmdCopy.UseVisualStyleBackColor = true;
            this._CmdCopy.Visible = false;
            // 
            // _CmdDelRow
            // 
            this._CmdDelRow.Image = ((System.Drawing.Image)(resources.GetObject("_CmdDelRow.Image")));
            this._CmdDelRow.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this._CmdDelRow.Location = new System.Drawing.Point(98, 3);
            this._CmdDelRow.Name = "_CmdDelRow";
            this._CmdDelRow.Size = new System.Drawing.Size(85, 24);
            this._CmdDelRow.TabIndex = 1;
            this._CmdDelRow.Text = "&2.Xóa dòng";
            this._CmdDelRow.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
            this._CmdDelRow.UseVisualStyleBackColor = true;
            // 
            // _CmdAddRow
            // 
            this._CmdAddRow.Image = ((System.Drawing.Image)(resources.GetObject("_CmdAddRow.Image")));
            this._CmdAddRow.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this._CmdAddRow.Location = new System.Drawing.Point(3, 3);
            this._CmdAddRow.Name = "_CmdAddRow";
            this._CmdAddRow.Size = new System.Drawing.Size(93, 24);
            this._CmdAddRow.TabIndex = 0;
            this._CmdAddRow.Text = "&1.Thêm dòng";
            this._CmdAddRow.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
            this._CmdAddRow.UseVisualStyleBackColor = true;
            // 
            // _Panel5
            // 
            this._Panel5.Location = new System.Drawing.Point(0, 0);
            this._Panel5.Name = "_Panel5";
            this._Panel5.Size = new System.Drawing.Size(200, 100);
            this._Panel5.TabIndex = 3;
            // 
            // _C1DockingTab2
            // 
            this._C1DockingTab2.Controls.Add(this._C1DockingTabPage2);
            this._C1DockingTab2.Dock = System.Windows.Forms.DockStyle.Fill;
            this._C1DockingTab2.Location = new System.Drawing.Point(0, 208);
            this._C1DockingTab2.Name = "_C1DockingTab2";
            this._C1DockingTab2.Size = new System.Drawing.Size(895, 273);
            this._C1DockingTab2.TabIndex = 2;
            this._C1DockingTab2.TabsSpacing = 5;
            this._C1DockingTab2.TabStyle = C1.Win.C1Command.TabStyleEnum.Office2007;
            this._C1DockingTab2.VisualStyle = C1.Win.C1Command.VisualStyle.Custom;
            this._C1DockingTab2.VisualStyleBase = C1.Win.C1Command.VisualStyle.Office2007Blue;
            // 
            // _C1DockingTabPage2
            // 
            this._C1DockingTabPage2.Controls.Add(this._VSList);
            this._C1DockingTabPage2.Location = new System.Drawing.Point(1, 24);
            this._C1DockingTabPage2.Name = "_C1DockingTabPage2";
            this._C1DockingTabPage2.Size = new System.Drawing.Size(893, 248);
            this._C1DockingTabPage2.TabIndex = 0;
            this._C1DockingTabPage2.Text = "Chi tiết ĐTTHCP";
            // 
            // _VSList
            // 
            this._VSList.BorderStyle = C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.Light3D;
            this._VSList.ColumnInfo = resources.GetString("_VSList.ColumnInfo");
            this._VSList.Dock = System.Windows.Forms.DockStyle.Fill;
            this._VSList.ExtendLastCol = true;
            this._VSList.KeyActionEnter = C1.Win.C1FlexGrid.KeyActionEnum.MoveAcross;
            this._VSList.Location = new System.Drawing.Point(0, 0);
            this._VSList.Margin = new System.Windows.Forms.Padding(0);
            this._VSList.Name = "_VSList";
            this._VSList.Rows.Count = 13;
            this._VSList.Rows.DefaultSize = 17;
            this._VSList.Rows.MaxSize = 20;
            this._VSList.Rows.MinSize = 20;
            this._VSList.Size = new System.Drawing.Size(893, 248);
            this._VSList.StyleInfo = resources.GetString("_VSList.StyleInfo");
            this._VSList.TabIndex = 0;
            this._VSList.VisualStyle = C1.Win.C1FlexGrid.VisualStyle.Office2007Blue;
            // 
            // _CmdExit
            // 
            this._CmdExit.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
            this._CmdExit.Image = ((System.Drawing.Image)(resources.GetObject("_CmdExit.Image")));
            this._CmdExit.ImageTransparentColor = System.Drawing.Color.White;
            this._CmdExit.Name = "_CmdExit";
            this._CmdExit.Size = new System.Drawing.Size(58, 22);
            this._CmdExit.Text = "Th&oát";
            // 
            // Frm_00TestParentChild
            // 
            this.ClientSize = new System.Drawing.Size(895, 569);
            this.ControlBox = false;
            this.Controls.Add(this._C1DockingTab2);
            this.Controls.Add(this._Panel4);
            this.Controls.Add(this._C1DockingTab1);
            this.Controls.Add(this._ToolStrip1);
            this.KeyPreview = true;
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "Frm_00TestParentChild";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Tag = "NDC-082";
            this.Text = "ĐỐI TƯỢNG TẬP HỢP CHI PHÍ";
            this._ToolStrip1.ResumeLayout(false);
            this._ToolStrip1.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this._C1DockingTab1)).EndInit();
            this._C1DockingTab1.ResumeLayout(false);
            this._C1DockingTabPage1.ResumeLayout(false);
            this._C1DockingTabPage1.PerformLayout();
            this._Panel4.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this._C1DockingTab2)).EndInit();
            this._C1DockingTab2.ResumeLayout(false);
            this._C1DockingTabPage2.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this._VSList)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        public void LoadDetailsDichVu(string strKhoa)
        {
            DataTable detailDichVu = this.objNK.GetDetailDichVu(strKhoa);
            int num = 0;
            C1.Win.C1FlexGrid.C1FlexGrid vSList = this.VSList;
            vSList.Rows.Count = 1;
            int num2 = detailDichVu.Rows.Count - 1;
            for (num = 0; num <= num2; num++)
            {
                vSList.AddItem("");
                vSList[vSList.Rows.Count - 1, 0] = RuntimeHelpers.GetObjectValue(detailDichVu.Rows[num]["Khoa"]);
                vSList[vSList.Rows.Count - 1, 1] = RuntimeHelpers.GetObjectValue(detailDichVu.Rows[num]["KhoaDoiTuongTapHopChiPhi"]);
                vSList[vSList.Rows.Count - 1, 2] = RuntimeHelpers.GetObjectValue(detailDichVu.Rows[num]["KhoaHangHoa"]);
                vSList[vSList.Rows.Count - 1, 3] = RuntimeHelpers.GetObjectValue(detailDichVu.Rows[num]["TenHangHoa"]);
                vSList[vSList.Rows.Count - 1, 4] = RuntimeHelpers.GetObjectValue(detailDichVu.Rows[num]["DienGiai"]);
            }
            vSList = null;
        }

        public bool SaveDVDetailsTemp()
        {

            int num3 = this.VSList.Rows.Count - 1;
            clsDoiTuongTHCPChiTiet objNKDV = this.objNKDV;
            //Test
            //String tmp = "";
            //for (int i = 0; i <=4; i++)
            //{
            //    if (this.VSList[1, i] != null)
            //        tmp += this.VSList[1, i].ToString();
            //}
            //MessageBox.Show(tmp);
            for (int i = 1; i <= num3; i++)
            {
                if (LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSList[i, 1]), "", modGeneral.TypeOfValue.Nothing).ToString().Trim() != "")
                {
                    if (LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSList[i, 0]), "", modGeneral.TypeOfValue.Nothing).ToString().Trim() == "")
                    {
                        this.VSList[i, 0] = modGeneral.CreatKey("DM_DoiTuongTapHopChiPhiChiTiet", 15, "");
                    }
                    objNKDV.Khoa = this.VSList[i, 0].ToString().Trim();
                    objNKDV.KhoaDoiTuongTHCP = this.cFrmKhoa;
                    objNKDV.KhoaHangHoa = LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSList[i, 2]), "", modGeneral.TypeOfValue.Nothing).ToString().Trim();
                    objNKDV.TenHangHoa = LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSList[i, 3]), "", modGeneral.TypeOfValue.Nothing).ToString().Trim();
                    objNKDV.DienGiai = LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSList[i, 4]), "", modGeneral.TypeOfValue.Nothing).ToString().Trim();
                    if (!objNKDV.Save())
                    {
                        return false;
                    }
                }
            }
            objNKDV = null;
            return true;
        }

        public void ShowData(string strKhoa)
        {
            if (this.objNK.Load(strKhoa))
            {
                clsDMDoiTuongTapHopChiPhi objNK = this.objNK;
                this.CboLoaiDT.SelectedValue = objNK.KhoaLoaiDTTHCP.ToString().Trim();
                this.CboThuoc.SelectedValue = objNK.KhoaDTTHCP.ToString().Trim();
                this.TxtDienGiai.Text = objNK.DienGiai.ToString().Trim();
                this.TxtTenViet.Text = objNK.TenViet.ToString().Trim();
                this.TxtTenAnh.Text = objNK.TenAnh.ToString().Trim();
                this.TxtDienGiai.Text = objNK.DienGiai.ToString().Trim();
                this.checkBox1.CheckState = (CheckState)objNK.Active;
                this.TxtMa.Text = objNK.Ma.ToString().Trim();
                objNK = null;
                this.LoadDetailsDichVu(strKhoa);
            }
        }
        private void CmdSave_Click(object sender, EventArgs e)
        {
            if (this.CheckIvalid())
            {
                if (!this.SaveDVDetailsTemp())
                {
                    this.objNK.ClearTemp(this.cFrmKhoa);
                }
                else if (Conversions.ToBoolean(Microsoft.VisualBasic.CompilerServices.Operators.NotObject(this.UpdateData())))
                {
                    this.objNK.ClearTemp(this.cFrmKhoa);
                }

                else
                {
                    this.objNK.ClearTemp(this.cFrmKhoa);
                    this.cFrmTask = "";
                    this.EnabledControl = false;
                }
            }
        }

        private void TxtDienGiai_LostFocus(object sender, EventArgs e)
        {
            this.CmdAddRow.Focus();
        }

        public object UpdateData()
        {
            object obj2;
            clsDMDoiTuongTapHopChiPhi objCP = this.objNK;
            objCP.Khoa = this.cFrmKhoa;
            objCP.KhoaLoaiDTTHCP = this.CboLoaiDT.SelectedValue.ToString().Trim();
            if (LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.CboThuoc.SelectedValue), "", modGeneral.TypeOfValue.Nothing).ToString().Trim() != "")
            {
                objCP.KhoaDTTHCP = this.CboThuoc.SelectedValue.ToString().Trim();//this.CboThuoc.SelectedValue.ToString().Trim();
            }
            objCP.Ma = this.TxtMa.Text.Trim();
            objCP.TenAnh = this.TxtTenAnh.Text.Trim();
            objCP.TenViet = this.TxtTenViet.Text.Trim();
            objCP.DienGiai = this.TxtDienGiai.Text.Trim();
            if (objCP.KhoaNhanVienCapNhat.Trim() == "")
            {
                objCP.KhoaNhanVienCapNhat = modGeneral.H_USERID;
            }
            return objNK.Save();
            objNK = null;
            return obj2;
        }

        private void VSList_AfterEdit(object sender, RowColEventArgs e)
        {
            string expression = "";
            switch (e.Col)
            {
                case 2:
                    {
                        expression = SearchModule.SearchHangHoa(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSList[e.Row, 2]), "", modGeneral.TypeOfValue.Nothing).ToString(), "", "");
                        if (expression == "")
                        {
                            this.VSList[e.Row, 1] = "";
                            this.VSList[e.Row, 2] = "";
                            break;
                        }
                        object instance = Strings.Split(expression, "|", -1, CompareMethod.Binary);
                        this.VSList[e.Row, 1] = RuntimeHelpers.GetObjectValue(NewLateBinding.LateIndexGet(instance, new object[] { 0 }, null));
                        this.VSList[e.Row, 2] = RuntimeHelpers.GetObjectValue(NewLateBinding.LateIndexGet(instance, new object[] { 1 }, null));
                        this.VSList[e.Row, 3] = RuntimeHelpers.GetObjectValue(NewLateBinding.LateIndexGet(instance, new object[] { 2 }, null));

                        this.VSList.Select(e.Row, 4);
                        break;
                    }
                case 8:
                case 9:
                    break;

                case 10:
                case 11:
                    break;
            }
        }

        private void VSList_BeforeEdit(object sender, RowColEventArgs e)
        {
            if (!this.mEnabledControl)
            {
                e.Cancel = true;
            }
        }

        internal virtual C1DockingTab C1DockingTab1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._C1DockingTab1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._C1DockingTab1 = value;
            }
        }

        internal virtual C1DockingTab C1DockingTab2
        {
            [DebuggerNonUserCode]
            get
            {
                return this._C1DockingTab2;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._C1DockingTab2 = value;
            }
        }

        internal virtual C1DockingTabPage C1DockingTabPage1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._C1DockingTabPage1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._C1DockingTabPage1 = value;
            }
        }

        internal virtual C1DockingTabPage C1DockingTabPage2
        {
            [DebuggerNonUserCode]
            get
            {
                return this._C1DockingTabPage2;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._C1DockingTabPage2 = value;
            }
        }
        internal virtual ComboBox CboLoaiDT
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CboLoaiDT;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this._CboLoaiDT_SelectedIndexChanged);
                if (this._CboLoaiDT != null)
                {
                    this._CboLoaiDT.SelectedIndexChanged -= handler;
                }
                this._CboLoaiDT = value;
                if (this._CboLoaiDT != null)
                {
                    this._CboLoaiDT.SelectedIndexChanged += handler;
                }
            }
        }
        internal virtual ComboBox CboThuoc
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CboThuoc;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this._CboThuoc_SelectedIndexChanged);
                if (this._CboThuoc != null)
                {
                    this._CboThuoc.SelectedIndexChanged -= handler;
                }
                this._CboThuoc = value;
                if (this._CboThuoc != null)
                {
                    this._CboThuoc.SelectedIndexChanged += handler;
                }
            }
        }


        internal virtual ToolStripButton CmdAdd
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdAdd;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdAdd_Click);
                if (this._CmdAdd != null)
                {
                    this._CmdAdd.Click -= handler;
                }
                this._CmdAdd = value;
                if (this._CmdAdd != null)
                {
                    this._CmdAdd.Click += handler;
                }
            }
        }

        internal virtual Button CmdAddRow
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdAddRow;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdAddRow_Click);
                if (this._CmdAddRow != null)
                {
                    this._CmdAddRow.Click -= handler;
                }
                this._CmdAddRow = value;
                if (this._CmdAddRow != null)
                {
                    this._CmdAddRow.Click += handler;
                }
            }
        }

        internal virtual Button CmdCopy
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdCopy;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdCopy_Click);
                if (this._CmdCopy != null)
                {
                    this._CmdCopy.Click -= handler;
                }
                this._CmdCopy = value;
                if (this._CmdCopy != null)
                {
                    this._CmdCopy.Click += handler;
                }
            }
        }

        internal virtual ToolStripButton CmdDel
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdDel;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdDel_Click);
                if (this._CmdDel != null)
                {
                    this._CmdDel.Click -= handler;
                }
                this._CmdDel = value;
                if (this._CmdDel != null)
                {
                    this._CmdDel.Click += handler;
                }
            }
        }

        internal virtual Button CmdDelRow
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdDelRow;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdDelRow_Click);
                if (this._CmdDelRow != null)
                {
                    this._CmdDelRow.Click -= handler;
                }
                this._CmdDelRow = value;
                if (this._CmdDelRow != null)
                {
                    this._CmdDelRow.Click += handler;
                }
            }
        }

        internal virtual ToolStripButton CmdEdit
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdEdit;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdEdit_Click);
                if (this._CmdEdit != null)
                {
                    this._CmdEdit.Click -= handler;
                }
                this._CmdEdit = value;
                if (this._CmdEdit != null)
                {
                    this._CmdEdit.Click += handler;
                }
            }
        }

        internal virtual ToolStripButton CmdExit
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdExit;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdExit_Click);
                if (this._CmdExit != null)
                {
                    this._CmdExit.Click -= handler;
                }
                this._CmdExit = value;
                if (this._CmdExit != null)
                {
                    this._CmdExit.Click += handler;
                }
            }
        }

        internal virtual ToolStripButton cmdHelp
        {
            [DebuggerNonUserCode]
            get
            {
                return this._cmdHelp;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._cmdHelp = value;
            }
        }

        internal virtual ToolStripButton CmdPrint
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdPrint;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdPrint_Click);
                if (this._CmdPrint != null)
                {
                    this._CmdPrint.Click -= handler;
                }
                this._CmdPrint = value;
                if (this._CmdPrint != null)
                {
                    this._CmdPrint.Click += handler;
                }
            }
        }

        internal virtual ToolStripButton CmdSave
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdSave;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdSave_Click);
                if (this._CmdSave != null)
                {
                    this._CmdSave.Click -= handler;
                }
                this._CmdSave = value;
                if (this._CmdSave != null)
                {
                    this._CmdSave.Click += handler;
                }
            }
        }

        internal virtual ToolStripButton CmdUnsave
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdUnsave;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdUnsave_Click);
                if (this._CmdUnsave != null)
                {
                    this._CmdUnsave.Click -= handler;
                }
                this._CmdUnsave = value;
                if (this._CmdUnsave != null)
                {
                    this._CmdUnsave.Click += handler;
                }
            }
        }

        public bool EnabledControl
        {
            get
            {
                return this.mEnabledControl;
            }
            set
            {
                this.mEnabledControl = value;
                this.CmdAdd.Enabled = !value & this.mAllowAdd;
                this.CmdEdit.Enabled = !value & this.mAllowEdit;
                this.CmdDel.Enabled = !value & this.mAllowDel;
                this.CmdSave.Enabled = value;
                this.CmdUnsave.Enabled = value;
                this.CmdExit.Enabled = !value;
                this.CmdAddRow.Enabled = value;
                this.CmdDelRow.Enabled = value;
                this.CmdCopy.Enabled = value;
                this.CmdPrint.Enabled = !value;
                //this.TxtTenViet.Enabled = !value;
                //this.TxtTenAnh.Enabled = !value;
                //this.TxtDienGiai.Enabled = !value;
                this.TxtTenViet.ReadOnly = !value;
                this.TxtTenAnh.ReadOnly = !value;
                this.TxtDienGiai.ReadOnly = !value;
                this.TxtMa.ReadOnly = !value;
                this.CboThuoc.Enabled = value;
                this.CboLoaiDT.Enabled = value;
                this.checkBox1.Enabled = value;               
            }
        }

        internal virtual Label Label1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label1 = value;
            }
        }

        internal virtual Label Label11
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label2;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label2 = value;
            }
        }

        internal virtual Label Label12
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label3;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label3 = value;
            }
        }

        internal virtual Label Label2
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label2;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label2 = value;
            }
        }

        internal virtual Label Label3
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label3;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label3 = value;
            }
        }

        internal virtual Panel Panel4
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Panel4;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Panel4 = value;
            }
        }

        internal virtual Panel Panel5
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Panel5;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Panel5 = value;
            }
        }

        internal virtual ToolStrip ToolStrip1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._ToolStrip1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._ToolStrip1 = value;
            }
        }

        internal virtual ToolStripSeparator ToolStripButton1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._ToolStripButton1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._ToolStripButton1 = value;
            }
        }

        internal virtual ToolStripSeparator ToolStripSeparator1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._ToolStripSeparator1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._ToolStripSeparator1 = value;
            }
        }

        internal virtual ToolStripSeparator ToolStripSeparator2
        {
            [DebuggerNonUserCode]
            get
            {
                return this._ToolStripSeparator2;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._ToolStripSeparator2 = value;
            }
        }

        internal virtual TextBox TxtDienGiai
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtDienGiai;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.TxtDienGiai_LostFocus);
                if (this._TxtDienGiai != null)
                {
                    this._TxtDienGiai.LostFocus -= handler;
                }
                this._TxtDienGiai = value;
                if (this._TxtDienGiai != null)
                {
                    this._TxtDienGiai.LostFocus += handler;
                }
            }
        }
        internal virtual TextBox TxtMa
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtMa;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.TxtMa_LostFocus);
                if (this._TxtMa != null)
                {
                    this._TxtMa.LostFocus -= handler;
                }
                this._TxtMa = value;
                if (this._TxtMa != null)
                {
                    this._TxtMa.LostFocus += handler;
                }
            }
        }
        internal virtual TextBox TxtTenViet
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtTenViet;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.TxtTenViet_LostFocus);
                if (this._TxtTenViet != null)
                {
                    this._TxtTenViet.LostFocus -= handler;
                }
                this._TxtTenViet = value;
                if (this._TxtTenViet != null)
                {
                    this._TxtTenViet.LostFocus += handler;
                }
            }
        }
        internal virtual TextBox TxtTenAnh
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtTenAnh;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.TxtDienGiai_LostFocus);
                if (this._TxtTenAnh != null)
                {
                    this._TxtTenAnh.LostFocus -= handler;
                }
                this._TxtTenAnh = value;
                if (this._TxtTenAnh != null)
                {
                    this._TxtTenAnh.LostFocus += handler;
                }
            }
        }

        internal virtual C1.Win.C1FlexGrid.C1FlexGrid VSList
        {
            //  [DebuggerNonUserCode]
            get
            {
                return this._VSList;
            }
            //  [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                RowColEventHandler handler = new RowColEventHandler(this.VSList_AfterEdit);
                RowColEventHandler handler2 = new RowColEventHandler(this.VSList_BeforeEdit);
                if (this._VSList != null)
                {
                    this._VSList.AfterEdit -= handler;
                    this._VSList.BeforeEdit -= handler2;
                }
                this._VSList = value;
                if (this._VSList != null)
                {
                    this._VSList.AfterEdit += handler;
                    this._VSList.BeforeEdit += handler2;
                }
            }
        }

        private void _CboLoaiDT_SelectedIndexChanged(object sender, EventArgs e)
        {

            if (LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.CboLoaiDT.SelectedValue), "", modGeneral.TypeOfValue.Nothing).ToString().Trim() != "")
            {
                clsLoaiDoiTuongTapHopChiPhi don = new clsLoaiDoiTuongTapHopChiPhi();
                don.Load(this.CboLoaiDT.SelectedValue.ToString());
            }
        }
        private void _CboThuoc_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.CboThuoc.SelectedValue), "", modGeneral.TypeOfValue.Nothing).ToString().Trim() != "")
            {
                clsDMDoiTuongTapHopChiPhi don = new clsDMDoiTuongTapHopChiPhi();
                don.Load(this.CboThuoc.SelectedValue.ToString());
            }
        }


        public EventHandler TxtMa_LostFocus { get; set; }

        public EventHandler TxtTenViet_LostFocus { get; set; }
    }
}

